
package main

import (
	"fmt"
	"github.com/koding/kite"
	"github.com/koding/kite/protocol"
)

func main() {
	k := kite.New("second", "1.0.0")
	// search a kite that has the same username and environment as us, but the
	// kite name should be "first"
	kites, _ := k.GetKites(&protocol.KontrolQuery{
		Username:    k.Config.Username,
		Environment: k.Config.Environment,
		Name:        "first",
	})

	// there might be several kites that matches our query
	client := kites[0]
	client.Dial()
	response, _ := client.Tell("square", 4)
	fmt.Println(response.MustFloat64())
}
//GetKites方法会连接Kontrol，并获取符合查找条件的kites列表。
//
//本例子中是查找同一个用户名下面名为"first"的所有kites，如果该用户注册了10个名为"first"的kites，
//在client都能返回，调用方可以使用特定的负载均衡算法（例如round robin）选择其中一个。
